package rhinestone.Control;

import rhinestone.Model.Staff;
import rhinestone.Model.StaffContainer;
import rhinestone.Model.Customer;
import rhinestone.Model.CustomerContainer;
import rhinestone.Model.StatisticCalculator;

/**
 * Controls the statistics.
 *
 * @author Group 2
 * @version 2010.12.24
 */
public class StatisticsController {
	private StaffContainer staffContainer;
	private CustomerContainer customerContainer;
	private StatisticCalculator statisticCalculator;

	public StatisticsController(StaffContainer staffContainer, CustomerContainer customerContainer, StatisticCalculator statisticCalculator) {
		this.staffContainer = staffContainer;
		this.customerContainer = customerContainer;
		this.statisticCalculator = statisticCalculator;
	}

	public String getEmployeeStatistic(String cpr) {
		Staff staff = staffContainer.getStaff(cpr);
		return staff == null ? null : statisticCalculator.getStatistic(staff);
	}

	public String getCustomerStatistic(String cpr) {
		Customer customer = customerContainer.getCustomer(cpr);
		return customer == null ? null : statisticCalculator.getStatistic(customer);
	}
}
